import 'package:flutter/cupertino.dart';
import 'package:flutter/material.dart';
import 'package:flutter_bmfmap_example/pages/marketpage/pages/goodpage/goodpage.dart';

class GoodsSwiper extends StatefulWidget {
  GoodsSwiper({Key key, this.id,this.title, this.mtitle,this.url,this.tagname}) : super(key: key);

  int id;
  String title;
  String mtitle;
  String url;
  String tagname;

  @override
  _GoodsCardState createState() => _GoodsCardState();
}

class _GoodsCardState extends State<GoodsSwiper> {
  @override
  Widget build(BuildContext context) {
    print("name"+widget.tagname);
    return InkWell(
      onTap: () {
          Navigator.push(context, MaterialPageRoute(builder: (context)=>GoodPage(id: widget.id,url1: widget.url,tagname: widget.tagname,)));
        },
      child: Container(
        decoration: BoxDecoration(
          gradient: LinearGradient(
            begin: Alignment.centerLeft,
            end: Alignment.centerRight,
            colors: [
              Color.fromRGBO(186, 162, 224, 1),
              Color.fromRGBO(214, 196, 244, 1),
            ],
          ),
          borderRadius: BorderRadius.all(Radius.circular(20.0)),
          boxShadow: [
            BoxShadow(
              color: Color.fromRGBO(238, 231, 246, 1),
              offset: Offset(0, 8.0), //阴影y轴偏移量
            )
          ],
        ),
        child: Row(
          children: [
            Padding(
              padding: const EdgeInsets.all(16.0),
              child: Column(
                mainAxisAlignment: MainAxisAlignment.center,
                children: [
                  Text(
                    '${widget.title}',
                    style: TextStyle(
                      color: Color.fromRGBO(216, 198, 243, 1),
                      fontSize: 16,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  Text(
                     '${widget.mtitle}',
                    style: TextStyle(
                      color: Color.fromRGBO(253, 249, 246, 1),
                      fontSize: 20,
                      fontWeight: FontWeight.bold,
                    ),
                  ),
                  Icon(
                    Icons.keyboard_arrow_right,
                    color: Color.fromRGBO(236, 227, 243, 1),
                    size: 30,
                  ),
                ],
              ),
            ),
            Spacer(),
            Padding(
              padding: const EdgeInsets.all(16.0),
              child: Hero(
                tag: widget.tagname,
                child: Container(
                  width: 120,
                  height: 120,
                  child: Image.network(
                    '${widget.url}',
                    fit: BoxFit.fitHeight,
                  ),
                  // color: Color.fromRGBO(255,255,255,0.5),
                ),
              ),
            ),
          ],
        ),
    
      ),
    );
  }
}
